package com.hsc.yalebao.weight;

import android.content.Context;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.Scroller;
import android.widget.TextView;

public class RollView extends FrameLayout
{
  int i = 1;
  private boolean ischange = false;
  private int mHeight;
  private Scroller mScroller;
  private int mWidth;
  private OnPreTextChangeListener mlistener;

  public RollView(Context paramContext)
  {
    this(paramContext, null);
  }

  public RollView(Context paramContext, AttributeSet paramAttributeSet)
  {
    this(paramContext, paramAttributeSet, 0);
  }

  public RollView(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet, paramInt);
    this.mScroller = new Scroller(paramContext);
  }

  public void computeScroll()
  {
    if (this.mScroller.computeScrollOffset())
    {
      scrollTo(this.mScroller.getCurrX(), this.mScroller.getCurrY());
      invalidate();
    }
    do
    {
      return;
      if (getScrollY() == this.mHeight)
      {
        if (this.ischange);
        for (boolean bool = false; ; bool = true)
        {
          this.ischange = bool;
          this.i = (1 + this.i);
          postDelayed(new Runnable()
          {
            public void run()
            {
              RollView.this.mScroller.startScroll(0, 0, 0, RollView.this.mHeight, 1200);
              RollView.this.scrollTo(0, 0);
              RollView.this.requestLayout();
              if (RollView.this.getChildAt(0).getBottom() == RollView.this.mHeight)
                RollView.this.mlistener.SetOnPreTextChangeListener((TextView)RollView.this.getChildAt(0));
              while (true)
              {
                RollView.this.postInvalidate();
                return;
                if (RollView.this.getChildAt(1).getBottom() == RollView.this.mHeight)
                  RollView.this.mlistener.SetOnPreTextChangeListener((TextView)RollView.this.getChildAt(1));
              }
            }
          }
          , 2000L);
          return;
        }
      }
    }
    while (getScrollY() != 0);
    getHandler().removeCallbacksAndMessages(null);
    postDelayed(new Runnable()
    {
      public void run()
      {
        RollView.this.mScroller.startScroll(0, 0, 0, RollView.this.mHeight, 1200);
        RollView.this.postInvalidate();
      }
    }
    , 2000L);
  }

  public void initText(String paramString1, String paramString2)
  {
    ((TextView)getChildAt(0)).setText(paramString1);
    ((TextView)getChildAt(1)).setText(paramString2);
  }

  protected void onDetachedFromWindow()
  {
    super.onDetachedFromWindow();
    this.mScroller.abortAnimation();
    getHandler().removeCallbacksAndMessages(null);
  }

  protected void onFinishInflate()
  {
    super.onFinishInflate();
    if (getChildCount() != 2)
      new IllegalArgumentException("must be has 2 children.");
  }

  protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    if (this.ischange)
    {
      getChildAt(1).layout(0, 0, this.mWidth, this.mHeight);
      getChildAt(0).layout(0, this.mHeight, this.mWidth, 2 * this.mHeight);
      return;
    }
    getChildAt(0).layout(0, 0, this.mWidth, this.mHeight);
    getChildAt(1).layout(0, this.mHeight, this.mWidth, 2 * this.mHeight);
  }

  protected void onMeasure(int paramInt1, int paramInt2)
  {
    super.onMeasure(paramInt1, paramInt2);
    this.mHeight = getChildAt(0).getMeasuredHeight();
    this.mWidth = getChildAt(0).getMeasuredWidth();
  }

  public void setOnPreTextChangeListener(OnPreTextChangeListener paramOnPreTextChangeListener)
  {
    this.mlistener = paramOnPreTextChangeListener;
  }

  public static abstract interface OnPreTextChangeListener
  {
    public abstract void SetOnPreTextChangeListener(TextView paramTextView);
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.weight.RollView
 * JD-Core Version:    0.6.2
 */